<%-- 
    Document   : index
    Created on : 2013-11-12, 12:58:33
    Author     : 赵远
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html lang="zh">
    <head>
        <META HTTP-EQUIV="Content-Language" CONTENT="zh">
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <title>用户登录</title>
        <style type="text/css" media="screen">		
            td label   		{ font-size: 0.85em ; padding-right: 0.2em; }
            label 		{ font-size: 0.77em; padding-right: 0.2em; }
            .instructions 	{ color: #4d6d8b; font-size: 0.8em; margin: 0 10px 10px 0 }
            .STYLE1 {color: #FF0000}
            .STYLE2 {color: #000000}
        </style>
        <script type="text/javascript" src="<%=basePath%>js/showhide_2.js"></script>
        <script language="JavaScript">
            var i = 0;

            function imageSubmit()
            {
                if (i == 0)
                {
                    i = 1;
                    if (document.getElementById("rembcode").checked) {
                        setCookieCode();
                    } else {
                        delCookie("UserName");
                    }
                    if (document.getElementById("rembpwd").checked) {
                        setCookiePwd();
                    } else {
                        delCookie("UserPwd");
                    }
                    document.IDPLogin.submit();
                }

                return false;
            }

            //设置用户名
            function setCookieCode() {
                var expdate = new Date();
                expdate.setTime(expdate.getTime() + 10000 * (365 * 24 * 60 * 60 * 1000));
                SetCookie("UserName", document.getElementById("Ecom_User_ID").value, expdate);
            }
            // 保存密码
            function setCookiePwd() {
                var expdate = new Date();
                expdate.setTime(expdate.getTime() + 10000 * (365 * 24 * 60 * 60 * 1000));
                SetCookie("UserPwd", document.getElementById("Ecom_Password").value, expdate);
            }

            //创建指定名称的Cookie
            function SetCookie(name, value) {
                try {
                    var argv = SetCookie.arguments;
                    var argc = SetCookie.arguments.length;
                    var expires = (argc > 2) ? argv[2] : null;
                    var path = (argc > 3) ? argv[3] : null;
                    var domain = (argc > 4) ? argv[4] : null;
                    var secure = (argc > 5) ? argv[5] : false;
                    document.cookie = name + "=" + escape(value) +
                            ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
                            ((path == null) ? "" : ("; path=" + path)) +
                            ((domain == null) ? "" : ("; domain=" + domain)) +
                            ((secure == true) ? "; secure" : "");
                } catch (e) {
                    alert(e.message);
                }
            }

            // 自动填充用户
            function AutoLogin() {
                if ((GetCookie("UserName") != null) && (GetCookie("UserName") != "")) {
                    document.getElementById("Ecom_User_ID").value = GetCookie("UserName");
                    document.getElementById("rembcode").checked = true;
                }
                if ((GetCookie("UserPwd") != null) && (GetCookie("UserPwd") != "")) {
                    document.getElementById("Ecom_Password").value = GetCookie("UserPwd");
                    document.getElementById("rembpwd").checked = true;
                }
            }

            //获取指定Cookie名称的Cookie值
            function GetCookie(name) {
                var arg = name + "=";
                var alen = arg.length;
                var clen = document.cookie.length;
                var i = 0;
                while (i < clen) {
                    var j = i + alen;
                    if (document.cookie.substring(i, j) == arg)
                        return getCookieVal(j);
                    i = document.cookie.indexOf(" ", i) + 1;
                    if (i == 0)
                        break;
                }
                return null;
            }

            function getCookieVal(offset) {
                var endstr = document.cookie.indexOf(";", offset);
                if (endstr == -1)
                    endstr = document.cookie.length;
                return unescape(document.cookie.substring(offset, endstr));
            }


            //删除指定名称的cookie
            function delCookie(name) {
                var exp = new Date();
                exp.setTime(exp.getTime() - 1);
                var cval = GetCookie(name);
                if (cval != null)
                    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
            }

            //从用户框跳入到密码框,其他操作不做控制
            function onkeynext(id) {
                if (event.keyCode == 9) {
                    if (id == 1) {
                        document.IDPLogin.rembcode.focus();
                    } else if (id == 2) {
                        document.IDPLogin.Ecom_User_ID.focus();
                    } else if (id == 3) {
                        document.IDPLogin.Ecom_Password.focus();
                    }

                }
            }
        </script>
    </head>
    <body marginwidth="0" width="100%" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0" onLoad="document.IDPLogin.Ecom_User_ID.focus();" >
        <form name="IDPLogin" enctype="application/x-www-form-urlencoded" method="POST" action="<%=basePath%>jsp/login/do-login.jsp" >
            <input type="hidden" name="option" value="credential">
            <p>
                <!-- End ImageReady Slices -->
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
            </p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <table align="center" width="100%" height="130" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="16%" background="<%=basePath%>images/login_02.jpg"><img src="<%=basePath%>images/login_02.jpg" width="23" height="320" alt="q"></td>
                    <td width="83%" background="<%=basePath%>images/login_02.jpg"><table width="852" height="241" border="0" cellpadding="0" cellspacing="0">

                            <tr>
                                <td height="320" background="<%=basePath%>images/login_04.gif"><div id="top_blank" style="height:0px;"></div><table width="100%" height="142" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td width="49%"><span class="STYLE1"></td>
                                            <td width="51%" valign="bottom"><table width="100%" height="88" border="0" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td><table width="100%" border="0" cellspacing="1" cellpadding="1">
                                                                <tr>
                                                                    <td width="79%"\><font size="2">用户：</font>

                                                                        <input type="text" style="width:120px" id="Ecom_User_ID" class="input1" name="txtLogin" size="12" onkeydown = "onkeynext(1)" ><font size="2">&nbsp;<input type="checkbox" id="rembcode" name="rembcode" onkeydown = "onkeynext(3)">保存账户            </font>  </td>
                                                                </tr>
                                                                <tr >
                                                                    <td><font size="2">密码：</font>
                                                                        <input type="password" style="width:120px" id="Ecom_Password"  name="txtPassword" size="14" onkeydown = "onkeynext(2)">&nbsp;<input type="checkbox" id="rembpwd" name="rembpwd"><font size="2">保存密码</font></td>
                                                                </tr>
                                                                <tr>
                                                                    <td height="19"><table width="40%" border="0" cellspacing="0" cellpadding="0">
                                                                            <tr>

                                                                                <td width="100%" align="right"><label>                      
                                                                                        <input alt="登录" border="0" name="loginButton2" src="<%=basePath%>images/anq.gif" type="image" value="Login" onClick="return imageSubmit();">

                                                                                        <input  border="0" onClick="javascript:reset()" name="loginButton23" src="<%=basePath%>images/an_14.gif" type="image"  >
                                                                                    </label></td>
                                                                            </tr>  

                                                                        </table></td>
                                                                </tr>

                                                            </table></td>
                                                    </tr>
                                                </table></td>
                                        </tr>     						  
                                    </table></td>
                            </tr>

                        </table></td>
                    <td width="1%" background="<%=basePath%>images/login_02.jpg">&nbsp;</td>    
                </tr>
            </table>
            <div align="center" id="update">

            </div>
            <form>
                <p>&nbsp;</p>
                <script type="text/javascript">
                    AutoLogin();
                </script>

                <!--[if lte IE 7]>
      <script>
                
                   document.getElementById("update").innerHTML="您的浏览器版本较低，建议<a href='<%=basePath%>jsp/download/index.jsp'>升级浏览器</a>";
                </script>
                 <![endif]
                -->
                
                

                
                </body>
                <html>
